﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using ThuVienCT;
namespace QLCTNA
{
    public partial class Frm_quytrinh : Form
    {
        private ConnectionData cnn = null;
        public Frm_quytrinh()
        {
            InitializeComponent();
            FileText ft = new FileText("Config\\Config.ini");

            this.MaximizeBox = false;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            cnn = Connection.Connect();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {

            string insert = null;
            int check = 0;
            if (cnn.Check())
            {
                insert = " insert into vw_QuyTrinh([Mã Quy Trình],[Mã Công Thức],[Quy Trình])" + "values({0},{1},{2})";
                check = cnn.Execute(insert,txtmaquytrinh.Text,txtmacongthuc.Text,rtbqtrinh.Text);
                if (check > 0)
                {
                    MessageBox.Show("Đã lưu thành công", "thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("không lưu thành công", "thong bao", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

            }
        }

        private void rtbqtrinh_TextChanged(object sender, EventArgs e)
        {

        }

        private void Frm_quytrinh_Load(object sender, EventArgs e)
        {

        }
    }
}